
var pageSize = 99999999;
var vm = new Vue({
    el: "#app",
    data:function(){
        return{
            StandAreaTotal:"",
            StartStandAreaTotal:"",
            EndStandAreaTotal:"",
            EndStandAreaTotal:"",
            StartDMStandAreaTotal:"",
            //搜索条件
            StoreType:"",
            StoreTypeList:[
                {
                    value: '东明店面',
                    label: '东明店面'
                },
                {
                    value: '红星美凯龙',
                    label: '红星美凯龙'
                },
                {
                    value: '居然之家',
                    label: '居然之家'
                },
                {
                    value: '怀特',
                    label: '怀特'
                },
                {
                    value: '米氏',
                    label: '米氏'
                },
                {
                    value: '蓝天',
                    label: '蓝天'
                },
                {
                    value: '明月',
                    label: '明月'
                },
                {
                    value: '正定金河',
                    label: '正定金河'
                },
                {
                    value: '正定三才',
                    label: '正定三才'
                },
            ],
            Store:"",
            StoreList: [],
            ProductType:"",
            ProductTypeList:[
                {
                    value: '软体家具',
                    label: '软体家具'
                },
                {
                    value: '板式板木家具',
                    label: '板式板木家具'
                },
                {
                    value: '实木家具',
                    label: '实木家具'
                },
                {
                    value: '欧式家具',
                    label: '欧式家具'
                },
                {
                    value: '红木家具',
                    label: '红木家具'
                },
                {
                    value: '儿童家具',
                    label: '儿童家具'
                },
                {
                    value: '定制家具',
                    label: '定制家具'
                },
                {
                    value: '小件、家纺',
                    label: '小件、家纺'
                },
                {
                    value: '办公家具',
                    label: '办公家具'
                },
                {
                    value: '建材、异业',
                    label: '建材、异业'
                },
                {
                    value: '智能家具',
                    label: '智能家具'
                },
                {
                    value: '户外家具',
                    label: '户外家具'
                },
                {
                    value: '电器',
                    label: '电器'
                },
                {
                    value: '装饰公司',
                    label: '装饰公司'
                },
                {
                    value: '酒店家具',
                    label: '酒店家具'
                },
                {
                    value: '藤器',
                    label: '藤器'
                },
            ],
            Floor:"",
            FloorList:[
                {
                    value: '一楼',
                    label: '一楼'
                },
                {
                    value: '二楼',
                    label: '二楼'
                },
                {
                    value: '三楼',
                    label: '三楼'
                },
                {
                    value: '四楼',
                    label: '四楼'
                },
                {
                    value: '五楼',
                    label: '五楼'
                },
                {
                    value: '六楼',
                    label: '六楼'
                },
                {
                    value: '负一楼',
                    label: '负一楼'
                },
                {
                    value: '负二楼',
                    label: '负二楼'
                },
            ],
            StandType:"",
            StandTypeList:[
                {
                    value: '正常',
                    label: '正常'
                },
                {
                    value: '撤场中',
                    label: '撤场中'
                },
                {
                    value: '已撤场',
                    label: '已撤场'
                },
            ],
            BrandJson:"",
            BrandJsonList:[],
            BrandListJson:'',
            BrandListJsonList:[],
            //搜索条件end
            //搜索结果
            columns1: [
                {
                    type: 'index',
                    title: '序号',
                    align: 'center',
                },
                {
                    title: '店面分类',
                    key: 'StoreType',
                    align: 'center',
                },
                {
                    title: '中心店面',
                    key: 'Store',
                    align: 'center',
                },
                {
                    title: '楼层',
                    key: 'Floor',
                    align: 'center',
                },
                {
                    title: '产品品类',
                    key: 'ProductType',
                    align: 'center',
                },
                {
                    title: '展位编号',
                    key: 'StandNo',
                    align: 'center',
                },
                {
                    title: '展位名称',
                    key: 'StandName',
                    align: 'center',
                },
                {
                    title: '展位面积(平方米)',
                    key: 'StandArea',
                    align: 'center',
                },
                {
                    title: '展位状态',
                    key: 'Type',
                    align: 'center',
                },
                {
                    title: '品牌',
                    key: 'BrandName',
                    align: 'center',
                },
                {
                    title: '系列',
                    key: 'SeriesName',
                    align: 'center',
                },
                {
                    title: '入场时间',
                    key: 'RuTime',
                    align: 'center',
                },
                {
                    title: '负责人',
                    key: 'ResponsibleMan',
                    align: 'center',
                },
                {
                    title: '负责人职务',
                    key: 'Position',
                    align: 'center',
                },
                {
                    title: '负责人手机号',
                    key: 'RPhoneNo',
                    align: 'center',
                },
                {
                    title: '撤场时间',
                    key: 'EndTime',
                    align: 'center',
                },
                {
                    title: '撤场原因',
                    key: 'EndReason',
                    align: 'center',
                },
                {
                    title: '招商人店面',
                    key: 'ZsStore',
                    align: 'center',
                },
                {
                    title: '招商人部门',
                    key: 'ZsBm',
                    align: 'center',
                },
                {
                    title: '招商人姓名',
                    key: 'ZsUserName',
                    align: 'center',
                },
            ],
            // 接下来绑定数据，分别对应前面的列的key值来进行数据绑定
            data1: [],
            // 初始化信息总条数
            dataCount:0,
            stripe:true
        }
    },
    created(){
        this.initThisPage();
        this.queryBrandJson();
    },
    methods: {
        ok () {
        },
        cancel () {
        },
        queryBrandJson(){
            var self = this;
            $.ajax({
                url: "./goSHGL/queryBrandJson", //请求的url地址
                dataType: "json", //返回格式为json
                async:false,
                type: "GET", //请求方式
                processData: false, //对表单data数据是否进行序列化
                contentType: false, //dataType设置你收到服务器数据的格式
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    var brandjson = new Array();
                    var json = JSON.parse(data.data);
                    var tempbrandjson = json.data;
                    var temp = {
                        value: "",
                        label: "全部"
                    };
                    //添加品牌下拉start
                    brandjson.push(temp);
                    for(var i=0;i<tempbrandjson.length;i++){
                        var temp = {
                            value: tempbrandjson[i].BrandName,
                            label: tempbrandjson[i].BrandName
                        };
                        brandjson.push(temp)
                    }
                    self.BrandJsonList = brandjson;
                },
                error: function() {},
            });
        },
        changeBrandList(){
            var self = this;
            this.BrandListJsonList = [];
            this.BrandListJson = "";
            var BrandJson = this.BrandJson;

            var jsondata={ "BrandJson":BrandJson};
            var data_json = JSON.stringify(jsondata);
            $.ajax({
                url: "./goSHGL/queryBrandListByBrand", //请求的url地址
                dataType: "json", //返回格式为json
                async:true,
                data: data_json, //参数值
                type: "POST", //请求方式
                processData: false, //对表单data数据是否进行序列化
                contentType: false, //dataType设置你收到服务器数据的格式
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    var BrandListJsonList = data.BrandListJsonList;
                    for(var i=0;i<BrandListJsonList.length;i++){
                        var temp = {
                            value: BrandListJsonList[i].BrandID,
                            label: BrandListJsonList[i].SeriesName
                        };
                        self.BrandListJsonList.push(temp)
                    }
                },
                error: function() {},
            });
        },
        initThisPage(){
            $.ajax({
                url: "./goSHGL/initPage", //请求的url地址
                xhrFields: {
                    withCredentials: true
                },
                dataType: "json", //返回格式为json
                type: "GET", //请求方式
                processData: false, //对表单data数据是否进行序列化
                contentType: false, //dataType设置你收到服务器数据的格式
                headers: {
                    'Content-Type': 'application/json'
                },
                beforeSend: function() {
                    //请求前的处理
                },
                success: function(data) {
                    if(data.status==0){
                        // top.location.href = "../../login.html";
                        window.location.href="./login.html";
                    }else{}
                },
                complete: function() {
                    //请求完成的处理
                },
                error: function() {}
            });
        },
        changeStore(){
            var self = this;
            self.Store = "";
            self.StoreList = new Array();
            if(self.StoreType=="东明店面"){
                self.StoreList = [{value: "东明东二环店", label: "东明东二环店"},{value: "东明建华店", label: "东明建华店"},{value: "东明金利来店", label: "东明金利来店"},{value: "东明北杜店", label: "东明北杜店"},{value: "东明西二环店", label: "东明西二环店"},{value: "东明北二环店", label: "东明北二环店"},{value: "东明蒂摩玛办公馆", label: "东明蒂摩玛办公馆"}];
            }else if(self.StoreType=="红星美凯龙"){
                self.StoreList = [{value: "红星方北店", label: "红星方北店"},{value: "红星和平店", label: "红星和平店"},{value: "红星中储店", label: "红星中储店"},{value: "红星西古城店", label: "红星西古城店"}];
            }else if(self.StoreType=="居然之家"){
                self.StoreList = [{value: "居然之家长安店", label: "居然之家长安店"}];
            }else if(self.StoreType=="怀特"){
                self.StoreList = [{value: "怀特家具城", label: "怀特家具城"},{value: "怀特红木楼", label: "怀特红木楼"},{value: "怀特建材城", label: "怀特建材城"},{value: "怀特陶瓷城", label: "怀特陶瓷城"}];
            }else if(self.StoreType=="米氏"){
                self.StoreList = [{value: "米氏中华店", label: "米氏中华店"}];
            }else if(self.StoreType=="蓝天"){
                self.StoreList = [{value: "蓝天圣木家具城", label: "蓝天圣木家具城"}];
            }else if(self.StoreType=="明月"){
                self.StoreList = [{value: "明月家具城", label: "明月家具城"},{value: "新明月北二环店", label: "新明月北二环店"},{value: "明月石铜路装饰材料市场", label: "明月石铜路装饰材料市场"},{value: "明月丰收路装饰材料市场", label: "明月丰收路装饰材料市场"}];
            }else if(self.StoreType=="正定金河"){
                self.StoreList = [{value: "金河家具城", label: "金河家具城"}];
            }else if(self.StoreType=="正定三才"){
                self.StoreList = [{value: "三才家具城", label: "三才家具城"}];
            }
        },
        querytable(pageNum,pageSize){
            var self = this;
            var info ;
            var total;
            var StandAreaTotal;
            var StartStandAreaTotal;
            var EndStandAreaTotal;
            var StartDMStandAreaTotal;
            var StartOtherStandAreaTotal;
            var StoreType = this.StoreType;
            var Store = this.Store;
            var ProductType = this.ProductType;
            var Floor = this.Floor;
            var StandType = this.StandType;
            var jsondata={"StoreType": StoreType, "Store":Store,"ProductType":ProductType,"Floor":Floor,"StandType":StandType,"page":pageNum, "row":pageSize};
            var data_json = JSON.stringify(jsondata);
            $.ajax({
                url: "./goSHGL/queryAllZWInfos", //请求的url地址
                dataType: "json", //返回格式为json
                async:false,
                data: data_json, //参数值
                type: "POST", //请求方式
                processData: false, //对表单data数据是否进行序列化
                contentType: false, //dataType设置你收到服务器数据的格式
                headers: {
                    'Content-Type': 'application/json'
                },
                success: function(data) {
                    info = eval(data.data);
                    total = data.totalnum;
                    StandAreaTotal = data.StandAreaTotal;
                    StartStandAreaTotal = data.StartStandAreaTotal;
                    EndStandAreaTotal = data.EndStandAreaTotal;
                    StartDMStandAreaTotal = data.StartDMStandAreaTotal;
                    StartOtherStandAreaTotal = data.StartOtherStandAreaTotal;
                },
                error: function() {},
            });
            if(info){
                self.data1 = info;
                self.dataCount = total;
                self.StandAreaTotal = StandAreaTotal;
                self.StartStandAreaTotal = StartStandAreaTotal;
                self.EndStandAreaTotal = EndStandAreaTotal;
                self.StartDMStandAreaTotal = StartDMStandAreaTotal;
                self.StartOtherStandAreaTotal = StartOtherStandAreaTotal;
            }
        },
        // 2 分页
        changepage(index){
            this.querytable(index,pageSize);
        },
        //判断是否为面积
        isMianJi(mj){
          var reg = /^[1-9]+\d*(\.\d{0,2})?$|^0?\.\d{0,2}$/;
            if(reg.test(mj)){
                return true;
            }else{
                return false;
            }
        },


    }
})